home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / indents.zip / globals.h < prev    next >
C/C++ Source or Header  |  1993-05-30  |  17KB  |  323 lines

  1. /**
  2.  * Copyright 1989 Object Design, Inc.
  3.  * Copyright (c) 1985 Sun Microsystems, Inc.
  4.  * Copyright (c) 1980 The Regents of the University of California.
  5.  * Copyright (c) 1976 Board of Trustees of the University of Illinois. All
  6.  * rights reserved.
  7.  *
  8.  * Redistribution and use in source and binary forms are permitted provided
  9.  * that the above copyright notice and this paragraph are duplicated in all
  10.  * such forms and that any documentation, advertising materials, and other
  11.  * materials related to such distribution and use acknowledge that the
  12.  * software was developed by the University of California, Berkeley, the
  13.  * University of Illinois, Urbana, and Sun Microsystems, Inc.  The name of
  14.  * either University or Sun Microsystems may not be used to endorse or
  15.  * promote products derived from this software without specific prior written
  16.  * permission. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
  17.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES
  18.  * OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  19.  *
  20.  * @(#)globals.h    6.0 (Berkeley) 92/06/15 */
  21.  
  22. /* Note: To use this file you must set the linker to generate ComDedf's
  23.  * (common definitions). */
  24.  
  25. #include <stdio.h>
  26. #include <memory.h>
  27.  
  28. #ifdef __OS2__
  29. # define INCL_NOPM
  30. # define INCL_NOPMAPI
  31. # define INCL_BASE
  32. # define INCL_DOSFILEMGR
  33. # include <os2.h>
  34. #endif          /* __OS2__ */
  35.  
  36. /* Any compiler which supports real prototypes etc., */
  37. #if (defined __MSDOS__) || (defined MSDOS) || (defined __STDC__) || (defined __OS2__)
  38. # ifndef ANSIC
  39. #  define ANSIC
  40. # endif         /* ANSIC */
  41. #endif          /* __MSDOS__ || MSDOS) || __STDC__ || __OS2__ */
  42.  
  43.  
  44. #define BACKSLASH '\\'
  45. #define bufsize 1000            /* size of internal buffers */
  46. #define inp_bufs 1000           /* size of input buffer */
  47. #define sc_size 5000            /* size of save_com buffer */
  48. #define label_offset 2          /* number of levels a label is placed to left
  49.                                  * of code */
  50. #define cplus_ppp_indent 2      /* spaces to indent public, private,
  51.                                  * protected in c++ */
  52.  
  53. #define false 0
  54. #define true  1
  55.  
  56. #ifdef ANSIC
  57. # include <malloc.h>
  58. # define check_size(name) \
  59.     if (e_##name >= l_##name) { \
  60.             register int nsize = l_##name-s_##name+400; \
  61.         name##buf = (char *) realloc(name##buf, nsize); \
  62.         e_##name = name##buf + (e_##name-s_##name) + 1; \
  63.         l_##name = name##buf + nsize - 5; \
  64.         s_##name = name##buf + 1; \
  65.     }
  66. #else           /* ANSIC */
  67. # define check_size(name) \
  68.     if (e_/**/name >= l_/**/name) { \
  69.             register int nsize = l_/**/name-s_/**/name+400; \
  70.         name/**/buf = (char *) realloc(name/**/buf, nsize); \
  71.         e_/**/name = name/**/buf + (e_/**/name-s_/**/name) + 1; \
  72.         l_/**/name = name/**/buf + nsize - 5; \
  73.         s_/**/name = name/**/buf + 1; \
  74.     }
  75. #endif          /* ANSIC */
  76.  
  77. FILE           *input;          /* the file id for the input file */
  78. FILE           *output;         /* the output file */
  79.  
  80. char           *s_lab;          /* start ... */
  81. char           *e_lab;          /* .. and end of stored label */
  82. char           *l_lab;          /* limit of label buffer */
  83.  
  84. char           *s_code;         /* start ... */
  85. char           *e_code;         /* .. and end of stored code */
  86. char           *l_code;         /* limit of code section */
  87.  
  88. char           *s_com;          /* start ... */
  89. char           *e_com;          /* ... and end of stored comments */
  90. char           *l_com;          /* limit of comment buffer */
  91.  
  92. char            in_buffer[inp_bufs];    /* input buffer */
  93. char           *buf_ptr;        /* ptr to next character to be taken from
  94.                                  * in_buffer */
  95. char           *buf_end;        /* ptr to first after last char in in_buffer */
  96. char           *bp_save;        /* saved value of buf_ptr when taking input
  97.                                  * from save_com */
  98. char           *be_save;        /* similarly saved value of buf_end */
  99.  
  100. char            token[bufsize]; /* the last token scanned */
  101.  
  102. int             cplus;          /* c++ */
  103. int             pointer_as_binop;
  104. int             blanklines_after_declarations;
  105. int             blanklines_before_blockcomments;
  106. int             blanklines_after_procs;
  107. int             blanklines_around_conditional_compilation;
  108. int             swallow_optional_blanklines;
  109. int             n_real_blanklines;
  110. int             prefix_blankline_requested;
  111. int             postfix_blankline_requested;
  112.  
  113. int             tabsize;
  114. int             usetabs;
  115. int             list_defines;   /* PETER */
  116. int             show_options;   /* PETER */
  117. int             useStdio;
  118. int             useProfile;
  119.  
  120. int             break_comma;    /* when true and not in parens, break after a
  121.                                  * comma */
  122. int             btype_2;        /* when true, brace should be on same line as
  123.                                  * if, while, etc. */
  124. int             btype_3;        /* when true, braces are not only on the next
  125.                                  * line but indented with the enclosed code */
  126. float           case_ind;       /* indentation level to be used for a "case
  127.                                  * n:" */
  128. int             code_lines;     /* count of lines with code */
  129. int             had_eof;        /* set to true when input is exhausted */
  130. int             line_no;        /* the current line number. */
  131. int             max_col;        /* the maximum allowable line length */
  132. int             verbose;        /* when true, non-essential error messages
  133.                                  * are printed */
  134. int             cuddle_else;    /* true if else should cuddle up to '}' */
  135. int             else_or_endif;  /* -cp if in a #else */
  136. int             star_comment_cont;  /* true iff comment continuation lines
  137.                                      * should have stars at the beginning of
  138.                                      * each line. */
  139. int             comment_delimiter_on_blankline;
  140. int             troff;          /* true iff were generating troff input */
  141. int             procnames_start_line;   /* if true, the names of procedures
  142.                                          * being defined get placed in column
  143.                                          * 1 (i.e. a newline is placed
  144.                                          * between the type of the procedure
  145.                                          * and its name) */
  146. int             proc_calls_space;   /* If true, procedure calls look like:
  147.                                      * foo(bar) rather than foo (bar) */
  148. int             parens_space;   /* If true, parens gets spaces inside them */
  149. int             format_col1_comments;   /* If comments which start in column
  150.                                          * 1 are to be magically reformatted
  151.                                          * (just like comments that begin in
  152.                                          * later columns) */
  153. int             inhibit_formatting; /* true if INDENT OFF is in effect */
  154. int             suppress_blanklines;    /* set iff following blank lines
  155.                                          * should be suppressed */
  156. int             continuation_indent;    /* set to the indentation between the
  157.                                          * edge of code and continuation
  158.                                          * lines */
  159. int             lineup_to_parens;   /* if true, continued code within parens
  160.                                      * will be lined up to the open paren */
  161. int             Bill_Shannon;   /* true iff a blank should always be inserted
  162.                                  * after sizeof */
  163. int             blanklines_after_declarations_at_proctop;   /* This is vaguely
  164.                                                              * similar to
  165.                                                              * blanklines_after_decla
  166.                                                              * rations except that
  167.